package com.infoDiffusion.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.infoDiffusion.bean.WeatherInfoBean;
import com.infoDiffusion.dao.WeatherInfoDao;

@Service
@Transactional(propagation = Propagation.REQUIRED)
public class WeatherInfoService {
	@Autowired
	private WeatherInfoDao wdao;

	public boolean add(WeatherInfoBean wbean) {
		return wdao.add(wbean);
	}

	public List list(WeatherInfoBean wbean) {
		String hql = "from WeatherInfoBean";
		return wdao.getList(hql);
	}

	public boolean update(WeatherInfoBean wbean) {
		return wdao.update(wbean);
	}

	public WeatherInfoBean getById(int id) {
		return (WeatherInfoBean) wdao.getById(WeatherInfoBean.class, id);
	}

	public boolean delete(WeatherInfoBean wbean) {
		wdao.delete(wbean);
		return true;
	}

	public boolean updateById(int id) {
		String hql = "update WeatherInfoBean set username=?,password=?,power=?,create_date=?";
		return wdao.updateById(hql, id);
	}

}
